package com.yykj.user.center.server.repository.patient;

import com.yykj.user.center.server.model.PatientCardInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author chenl
 * @version 1.0
 * @date 2021/10/20 22:24
 */
@Repository
public interface PatientCardInfoRepository extends JpaRepository<PatientCardInfo, String>, JpaSpecificationExecutor<PatientCardInfo> {

        List<PatientCardInfo> findByAccountIdAndHospitalIdAndState(String accountId,Integer hospitalId,Boolean state);

        Integer countAllByAccountIdAndState(String accountId,Boolean state);

        Integer countAllByRelationAndAccountIdAndIdCard(String relation,String accountId,String idCard);

        Integer countAllByIdCardAndState(String idCard,Boolean state);

        PatientCardInfo findFirstByAccountIdAndIdCard(String accountId, String idCard);

        List<PatientCardInfo> findAllByAccountIdAndState(String accountId,Boolean state);

        Integer countAllByRelationAndAccountIdAndIdCardAndState(String relation, String accountId, String idCard, boolean b);
}
